/**
 * @author helio
 */
if (!SALE.view) SALE.view = {}

if (!SALE.view.CompanyRegisterPanel) {
	SALE.view.CompanyRegisterPanel = Ext.extend(SALE.basicGridPanel, {
	
		layout: 'fit',
		border: false,
		bodyStyle : 'background-color: transparent;', 
		initComponent: function(){
			
			// create the grid
			this.inputForm = new Ext.FormPanel({
				labelWidth: 55,
				border: false,
				autoHeight: true,
				buttonAlign: 'center',
				defaultType: 'textfield',
				bodyStyle : 'background-color: transparent;', 
				layout: 'form',
												
				items: [{
						border:false,
						xtype:'panel',
						bodyStyle : 'background-color: transparent;', 
						html: '<h1>公司基本信息</h1><hr>'
					}, {
						allowBlank: false,
						fieldLabel: '公司全称',
                    	name: 'name',
                    	anchor:'80%'		
					},{
						fieldLabel: '公司地址',
                    	name: 'address',
                    	anchor:'80%'		
					},{
						fieldLabel: '公司电话',
                    	name: 'tel',
                    	anchor:'50%'		
					},{
						vtype: 'email',
						allowBlank: false,
						fieldLabel: '企业邮箱',
                    	name: 'email',
                    	anchor:'50%'		
					}, {
						border:false,
						xtype:'panel',
						bodyStyle : 'background-color: transparent;', 
						html: '<h1>系统登录信息设定</h1><hr>'
					}, {
						fieldLabel: '用户名',
                    	name: 'loginid',
                    	allowBlank: false,
                    	anchor:'50%'	
					},{	
						inputType: 'password',
						fieldLabel: '登录密码',
                    	name: 'password',
                    	id: 'passwd',
                    	allowBlank: false,
                    	anchor:'50%'	
					},{
						inputType: 'password',
						vtype: 'password',
						fieldLabel: '确认密码',
                    	initialPassField: 'passwd',
                    	anchor:'50%'			
				}],
		      
				
				buttons: [{
		            text: '提交申请',
					listeners: {
						"click": function(){
							this.inputForm.form.doAction('submit', {
								
								url: SALE.App.configInfo.url + 'manage/register.php',
								method: 'post',
								
								success: function(form, action){
									Ext.MessageBox.show({
							           	title: '提交成功',
							           	msg: action.result.message,
							          	buttons: Ext.MessageBox.OK,
							          	fn: this.close.createDelegate(this),
							           	icon: Ext.MessageBox.INFO
							       	});
						        }.createDelegate(this),
						        
								failure: function(form, action){  									
									if(action.result) {
										this.errorMessage(action.result.message);
									}			
						        }.createDelegate(this)
							});							
						}.createDelegate(this)
					}
		        }]
			});
			
			this.items = this.inputForm;
			
			SALE.view.CompanyRegisterPanel.superclass.initComponent.call(this);
		},
	});
	
	Ext.reg('companyregister', SALE.view.CompanyRegisterPanel);
}